package org.nepu.scr.indexrate.converter.drillingrate.jobarticulation;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.jobarticulation.KeyJobRisk;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class KeyJobRiskConverter implements AttributeConverter<KeyJobRisk, String> {
    @Override
    public String convertToDatabaseColumn(KeyJobRisk keyJobRisk) {
        return JSONUtil.toJsonStr(keyJobRisk);
    }

    @Override
    public KeyJobRisk convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, KeyJobRisk.class);
    }
}
